package com.fatalsoftware.java.browserbee;

public class OSValidator {

	private String os;
	private Boolean isSupported;
	
	public OSValidator() 
	{
		os = "";
		isSupported = null;
	}

	public String getOs() 
	{
		return os;
	}

	public void setOs() 
	{
		this.os = System.getProperty("os.name").toLowerCase();
	}
	
	public Boolean getOsSupported()
	{
		//if ( this.isSupported == null )
			setIsSupported();
		
		return this.isSupported;
	}
	
	public void setIsSupported()
	{
		if ( isWindows7() || isWindowsXp() )
			this.isSupported = true;
		else
			this.isSupported = false;
	}
	
	public boolean isWindows7() 
	{
		return (this.os.indexOf("windows 7") >= 0);
	}
	
	public boolean isWindowsXp() 
	{
		return (this.os.indexOf("windows xp") >= 0);
	}
 
	public boolean isMac() 
	{
		return (this.os.indexOf("mac") >= 0);
	}
 
	public boolean isUnix() 
	{
		return (this.os.indexOf("nix") >= 0 || this.os.indexOf("nux") >= 0);
	}
}
